/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package push2java;

import java.lang.reflect.Method;
import java.util.List;
import push2java.Type.Literal;

/**
 *
 * @author Admin
 */
public class Expression implements Cloneable {

    public enum Type {

        INSTRUCTION, LITERAL, LIST
    };
    private Method instruction;
    private Object literal;
    private List<Expression> program;
    private Type type;
    private Literal literalType;

    public Expression() {
    }

    public Expression(Method instruction) {
        this.instruction = instruction;
        this.type = Type.INSTRUCTION;
    }

    public Expression(Object literal, Literal literalType) {
        this.literal = literal;
        this.type = Type.LITERAL;
        this.literalType = literalType;
    }

    public Method getInstruction() {
        return instruction;
    }

    public Object getLiteral() {
        return literal;
    }

    public List<Expression> getProgram() {
        return program;
    }

    public Type getType() {
        return type;
    }

    public Literal getLiteralType() {
        return literalType;
    }

    public Expression copy() {
        Expression copy = new Expression();
        copy.instruction = instruction;
        copy.literal = literal;
        copy.program = program;
        copy.type = type;
        copy.literalType = literalType;
        return copy;
    }
}
